// --------------------------------------------------------------------
if (($.browser.msie) && ($.browser.version <= "9.0")) {
	 $('.nav-container input[type=text]').val('Search...');
	 $('.nav-container input[type=text]').focus(function(){
				if($(this).val() == 'Search...' ){
					$(this).val('');
				}	
			});
	$('.nav-container input[type=text]').blur(function(){
				if($(this).val() == '' ){
					$(this).val('Search...');
				}
	});
	}
	
// slider  =========================================
$(window).load(function(){
      $('.flexslider').flexslider({
        animation: "fade",
		directionNav: false,
		slideshow: false,
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
    });
	
// -----------------------------------------------------------------------
// appends
	$('.content-block ul li, .list-links li').prepend('<span class="icon"></span>');
	$('.sitemap li li, .sitemap li li li, .not_found li').prepend( $( "<span class='icon'></span>" ) );
	$( ".content-block ul li" ).wrapInner( "<div class='text'></div>");
	$('.content-block ul li span.icon').each(function() {
				$(this).parent().before(this);
	});
	
// -----------------------------------------------------------------------
	$('.table tr:odd td').css('background', '#f2f2f2');
	var pageHeight = $('.inner-content .content').height();
	$('.main-column, .side-column').height(pageHeight+ 60);
	
	$('.calendar-right-side').height(pageHeight-100);
	
// ----------------------------------------------------------------------
// to top 
	$('.to-top').click(function(){
				$('html, body').animate({
					scrollTop: $(".inner-content h2").offset().top
				}, 700);
			});
$( ".to-top" ).append( $( "<span class='icon'></span>" ) );
	$( ".to-top" ).wrapInner( "<span class='text'></span>" );
	$('.to-top > span > span.icon ').each(function() {
		$(this).parent().before(this);
	});
	$('.to-top span.text').text('Back to top');
	
	
	
	/* ================================================
		Calendar & news 
   ================================================ */
$(window).load(function() {
		// top 
        $('.news-block:even p').each(function(index, element) {
            if ( $(this).children('i').length > 0 ) {
				$(this).children('i').css({float: 'right', marginRight: '0', marginLeft: '24px'});
				
		}
		else{
			$(this).children('span').css('width', 'auto');
		}
        });
		
		// bottom 
		$('.news-block:odd p').each(function(index, element) {
			if ( $(this).children('i').length > 0 ) {
				
				$(this).children('span').css({width: '435px'});
		}
		else{
			
			//$('.news-block:odd h4').css({float: 'left', width: 'auto'});
			$(this).children('span').css({width: 'auto'});
		}
		});
		
		$('.news-block p').each(function(){
			var y = $(this).width();
			var x = $(this).children('i').children('img').width()+26;
			$(this).children('.news-block p i + span').width(y-x);
			$(this).children('i').width($(this).children('i').children('img').width()+2);
			
			// console.log("image width" +'\n' + x);
			
			// console.log("paragraph" +'\n' + y);
		});
		
		$('.list-fake span.square').html('&#9642;');
    });
	
	
	var tabsHeight = $('#tabs').outerHeight();
	$('.tab-section').css('min-height' , tabsHeight)
	$('.tab-section').hide();
	$('#tabs a').bind('click', function(e){
		$('#tabs a.current').removeClass('current');
		$('.tab-section:visible').hide();
		$(this.hash).show();
		$(this).addClass('current');
		e.preventDefault();
	}).filter(':first').click();